var add_form_div,
    add_form_button,
    details_div;

$(document).ready(function () {
    add_form_div = $('#add_form');
    add_form_button = $('input[value="Show add form"]');
    details_div = $('#details');
});

function toggleAddForm() {
    add_form_div.slideToggle(700);
    add_form_button.attr('value',
        add_form_button.attr('value') == 'Show add form' ? 'Hide add form' : 'Show add form'
    );
}

function showDetails(id) {
    $.ajax({
        url: '/Quote/person/person',
        data: {id: id}
    }).done(function (data) {
            details_div.html(data);
            details_div.fadeIn(700);
        });
}

function hideDetails() {
    details_div.fadeOut(700);
}

function onSubmit() {
    $.ajax({
        type: 'POST',
        data: $('#form').serialize(),
        url: '/Quote/person/create'
    }).done(function (data) {
            $('#table').html(data);
            toggleAddForm();
        });

    return false;
}